home *** CD-ROM | disk | FTP | other *** search
- package sheet;
-
- import javax.microedition.lcdui.Canvas;
- import javax.microedition.lcdui.Graphics;
-
- final class CellResize extends Canvas {
- private Table data;
- private int appWidth;
- private int appHeight;
- private int curCol;
- private int curRow;
- private short curWid;
- private short curHei;
- private Backable winBack;
-
- public CellResize(Table var1, Backable var2) {
- this.data = var1;
- this.winBack = var2;
- this.appWidth = ((Canvas)this).getWidth();
- this.appHeight = ((Canvas)this).getHeight();
- this.curCol = this.data.getCurrentColumn();
- this.curRow = this.data.getCurrentRow();
- this.curWid = this.data.getColumnWidth(this.curCol);
- this.curHei = this.data.getRowHeight(this.curRow);
- }
-
- protected void paint(Graphics var1) {
- var1.setColor(16777215);
- var1.fillRect(0, 0, this.appWidth, this.appHeight);
- this.data.paint(var1, this.appWidth, this.appHeight, 1);
- }
-
- protected void keyPressed(int var1) {
- int var2 = ((Canvas)this).getGameAction(var1);
- switch (var2) {
- case 1:
- if (this.curHei > 1) {
- --this.curHei;
- this.data.setRowHeight(this.curRow, this.curHei);
- }
- break;
- case 2:
- if (this.curWid > 1) {
- --this.curWid;
- this.data.setColumnWidth(this.curCol, this.curWid);
- }
- break;
- case 3:
- case 4:
- case 7:
- default:
- if (var1 == -12) {
- this.winBack.show();
- return;
- }
- break;
- case 5:
- ++this.curWid;
- this.data.setColumnWidth(this.curCol, this.curWid);
- break;
- case 6:
- ++this.curHei;
- this.data.setRowHeight(this.curRow, this.curHei);
- break;
- case 8:
- this.winBack.show();
- return;
- }
-
- ((Canvas)this).repaint();
- }
- }
-